<?php
namespace app\miniprogram\controller;

/**
 * 退款
 */
class Refund extends Base
{
	protected $process = 'OrderRefund';

    //获取退款状态列表
    public function get_status_options() {
        $options = loadEnum('OrderRefundStatus')->get_options();
        $this->success('options', $options);
    }

    //用户查看自己的退款单列表
    public function private_list() {
        $this->ajax_process(function($process, $user) {
            return $process->private_list($user, function($model) {
                $search = loader()->loadAny('search', 'jy\\OrderRefund');
                $search->private_list($model);
            });
        });
    }

    //店铺查看自己的退款单列表
    public function store_private_list() {
        $this->ajax_process(function($process, $user) {
            return $process->store_private_list();
        });
    }

    //用户查询退款详情
    public function user_refund_info() {
        $this->ajax_process(function($process, $user) {
            return $process->user_refund_info();
        });
    }

    //用户退款信息详情
    public function user_refund_all_info() {
        $this->ajax_process(function($process, $user) {
            return $process->user_refund_all_info();
        });
    }

    //商家查询退款详情
    public function store_refund_info() {
        $this->ajax_process(function($process, $user) {
            return $process->store_refund_info();
        });
    }

    //商家退款信息详情
    public function store_refund_all_info() {
        $this->ajax_process(function($process, $user) {
            return $process->store_refund_all_info();
        });
    }

    //申请退款
    public function refund() {
        $this->ajax_process(function($process, $user) {
            return $process->refund();
        });
    }

    //商家操作退款申请
    public function store_refund_handle() {
        $this->ajax_process(function($process, $user) {
            return $process->store_refund_handle();
        });
    }

    //买家退货
    public function user_return_product() {
        $this->ajax_process(function($process, $user) {
            return $process->user_return_product_all();
        });
    }

    //商家收到退货产品
    public function store_received_return() {
        $this->ajax_process(function($process, $user) {
            return $process->store_received_return_all();
        });
    }

    //商家收到退货后操作退款申请
    public function store_refund_product_handle() {
        $this->ajax_process(function($process, $user) {
            return $process->store_refund_product_handle_all();
        });
    }

    //申请管理员介入
    public function apply_for_administrator_intervention() {
        $this->ajax_process(function($process, $user) {
            return $process->apply_for_administrator_intervention_all();
        });
    } 
    
}
